package com.jh.paymentchannel.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;

import static io.jsonwebtoken.lang.Strings.hasText;

/**
 * 微信配置表
 */
@Entity
@Table(name="t_weixin_service_no")
public class WeixinServiceNo implements Serializable{
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="id")
	private long id;

	/**
	 * 公众号APPID
	 */
	@Column(name="app_id")
	private String appid;

	/**
	 * 商户类型
	 */
	@Column(name="shop_type")
	private String shopType;

	/**
	 * 微信商户类型
	 */
	@Column(name="weixin_shop_type")
	private String weixinShopType;

	/**
	 * 商户id
	 */
	@Column(name="shop_id")
	private String shopId;

	/** 微信子商户号 */
	@Column(name="partner")
	private String partner;

	/**
	 * 微信key
	 */
	@Column(name="weixin_key")
	private String weixinKey;

	/**
	 * 公众号APPID
	 */
	@Column(name="public_app_id")
	private String publicAppId;

	/**
	 * 微信通道费率
	 */

	private transient String channelRate;

	@Column(name="create_time")
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	private Date createTime;

	@Column(name="create_by")
	private String createBy;


	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	@Column(name="update_time")
	private String updateTime;

	@Column(name="update_by")
	private String updateBy;

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getAppid() {
		return appid;
	}

	public void setAppid(String appid) {
		this.appid = appid;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getShopType() {
		return shopType;
	}

	public void setShopType(String shopType) {
		this.shopType = shopType;
	}

	public String getWeixinShopType() {
		return weixinShopType;
	}

	public void setWeixinShopType(String weixinShopType) {
		this.weixinShopType = weixinShopType;
	}

	public String getShopId() {
		return shopId;
	}

	public void setShopId(String shopId) {
		this.shopId = shopId;
	}

	public String getPartner() {
		return partner;
	}

	public void setPartner(String partner) {
		this.partner = partner;
	}

	public String getWeixinKey() {
		return weixinKey;
	}

	public void setWeixinKey(String weixinKey) {
		this.weixinKey = weixinKey;
	}

	public String getPublicAppId() {
		return publicAppId;
	}

	public void setPublicAppId(String publicAppId) {
		this.publicAppId = publicAppId;
	}

	public String getCreateBy() {
		return createBy;
	}

	public void setCreateBy(String createBy) {
		this.createBy = createBy;
	}

	public String getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(String updateTime) {
		this.updateTime = updateTime;
	}

	public String getUpdateBy() {
		return updateBy;
	}

	public void setUpdateBy(String updateBy) {
		this.updateBy = updateBy;
	}

	public String getChannelRate() {
		return channelRate;
	}

	public void setChannelRate(String channelRate) {
		this.channelRate = channelRate;
	}

	public boolean valid() {
		return hasText(getAppid()) && hasText(getShopId()) && hasText(getPartner());
	}
}
